package com.example.payment.strategy.impl;

import com.example.model.check_in.CheckIn;
import com.example.model.payment.Payment;
import com.example.model.payment.PaymentResultVo;
import com.example.payment.strategy.PayTypeStrategy;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.time.LocalDateTime;

@Component
public class CashStrategyImpl implements PayTypeStrategy {
    @Override
    public PaymentResultVo pay(Payment payment, BigDecimal amount, BigDecimal pay) {
        BigDecimal change = pay.subtract(amount);
        payment.setPaymentDate(LocalDateTime.now());

        PaymentResultVo paymentResultVo = new PaymentResultVo();
        paymentResultVo.setChange(change);
        paymentResultVo.setPaymentId(payment.getPaymentId());
        return paymentResultVo;

    }

    @Override
    public void refund(Long tradeNo, BigDecimal amount) {}
}
